<?php
$DB_IP="localhost";
$DB_USER="root";
$DB_PASSWD="";
$DB_NAME="visitors";

$TBL_SCENE_SPOTS="scene_spots";
$TBL_HOLIDAY="holiday";


function connectDBInit() {
	global $DB_IP, $DB_USER, $DB_PASSWD, $DB_NAME;
	return mysql_connect($DB_IP, $DB_USER, $DB_PASSWD);
}
function connectDB() {
	global $DB_IP, $DB_USER, $DB_PASSWD, $DB_NAME;
	$link = mysql_connect($DB_IP, $DB_USER, $DB_PASSWD);
	if(!$link) {
		echo mysql_error();
		return "ERR_ERR";
	}
	$sql = "use $DB_NAME";
	if(!mysql_query($sql, $link)) {
		echo mysql_error();
		return "ERR_ERR";
	}
	if(!mysql_query("SET NAMES 'utf8'")) {
		echo "ErrNo: ". mysql_errno(). "ErrDesc: ".mysql_error();
		return "ERR_ERR";
	}
		
	return $link;
	
}
?>
